import myReq from "../../common/http/myReq.js"
import data_storage from '@ohos.data.storage';
import featureAbility from '@ohos.ability.featureAbility';
import router from '@system.router';

export default {
    data: {
        title: 'World'
    },
    submit(e){
        if(e.value.username == 'monica' && e.value.password == '123456' && e.value.password_order == '123456'){
            router.push({
                uri:"pages/login/login"
            })
        }
    },
    navLogin(){
        router.push({
            uri:"pages/login/login"
        })
    }
    /**
    submit(e) {
        //获取表单用户输入信息
        const username = e.value.username;
        const password = e.value.password;
        //请求服务器进行用户登录
        //发送http请求-用户登录
        myReq.sendPostHttp("studentLogin",{
            "username":username,
            "password":password
        },(result)=>{
            const token = result.data.token;
            var context = featureAbility.getContext();
            context.getFilesDir().then((filePath) => {
                console.info("getFilesDirSuccess:"+filePath);
                console.info("token:"+token);
                let storage = data_storage.getStorageSync(filePath + '/mystore')
                storage.putSync('token', token);
                storage.flushSync();
                //内存中的token
                myReq.configData.token = token;
                //跳转到首页
                router.push({
                    uri: "pages/index/index"
                })
            });
        })
    }
    **/
}
